home *** CD-ROM | disk | FTP | other *** search
- /************************************************
- * *
- * RESDLL.CPP *
- * *
- * ResDll Library *
- * *
- *************************************************
- * *
- * by Software Builders (C) 1995-96 *
- * *
- * Visual C++ 1.52 for Windows 3.1 *
- * *
- ************************************************/
-
- #include "Windows.h"
-
- static HINSTANCE hDLLInstance=NULL;
-
-
- //-----------------------------------------------------------------------------------
- // DLL Entry Point
- extern "C" int CALLBACK LibMain(HINSTANCE p_hInstance, // handle of library instance
- WORD p_wDataSeg, // library data segment
- WORD p_wHeapSize, // default heap size
- LPSTR p_lpszCmdLine) // command-line arguments
- {
- hDLLInstance=p_hInstance;
- return 1; // ok
- };
-
- //-----------------------------------------------------------------------------------
- // Application call this make DLL register VBControl (VBX)
- extern "C" BOOL FAR PASCAL _loadds RegisterVBX(HINSTANCE p_hAppInstance) // Application hInstance
- {
- WNDCLASS wndClass;
- ::OutputDebugString("RegisterVBX\r\n");
-
-
- if (::GetClassInfo(hDLLInstance,"VBControl",&wndClass)==0) // If the class VBControl is not already registred by DLL
- {
- BOOL fOk=::GetClassInfo(p_hAppInstance,"VBControl",&wndClass); // Get App ClasInfo for VBControl
- if (fOk)
- {
- wndClass.hInstance = hDLLInstance; // Change the instance handle so it is that of the DLL and not the App.
- fOk=::RegisterClass(&wndClass); // Register the class
- if (!fOk)
- ::OutputDebugString("RegisterVBX: RegisterClass() Failed\r\n");
- }
- else
- ::OutputDebugString("RegisterVBX: GetClassInfo(p_hAppInstance) Failed\r\n");
- };
- return TRUE; // ok
- }
-
- //-----------------------------------------------------------------------------------
- // Exit DLL
- extern "C" int FAR PASCAL _WEP(int)
- {
- WNDCLASS wndClass;
- ::OutputDebugString("WEP-RegisterVBX\r\n");
-
- if (::GetClassInfo(hDLLInstance,"VBControl",&wndClass)) // If the class VBControl is registred by DLL
- {
- BOOL fOk=::UnregisterClass("VBControl",hDLLInstance); // Unregister It
- if (!fOk)
- ::OutputDebugString("_WEP(: UnregisterClass() Failed\r\n");
- };
- return 1;
- };
-
-